home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI500.ASC < prev    next >
Text File  |  1993-05-04  |  6KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Paradox                                NUMBER  :  500
  9.   VERSION  :  3.0 and up
  10.        OS  :  DOS
  11.      DATE  :  May 4, 1993                              PAGE  :  1/3
  12.  
  13.     TITLE  :  Creating a Report with a One-To-Many Relationship
  14.  
  15.  
  16.  
  17.  
  18.   Intended Audience:
  19.   All Paradox users
  20.  
  21.   Prerequisites:
  22.   You should have a thorough understanding of Paradox query and
  23.   report generation.
  24.  
  25.   Purpose of the TI:
  26.   This document will illustrate how to generate a report with a
  27.   one-to-many relationship from a database that has two or more
  28.   detail tables.
  29.  
  30.  
  31.   In this example, the following tables will be used:
  32.  
  33.   ┌──────────────────┐ ┌──────────────────┐ ┌───────────────────┐
  34.   │     CUSTOMER     │ │       ORDERS     │ │      QUOTES       │
  35.   │     ────────     │ │       ──────     │ │      ──────       │
  36.   │  Cust#       N*  │ │  Cust#       N*  │ │  Cust#        N*  │
  37.   │  Name        A35 │ │  Order#      N*  │ │  Quote#       N*  │
  38.   │  Address     A35 │ │  Order Item  A20 │ │  Quote Item   A20 │
  39.   │  City        A25 │ │  Order Price $   │ │  Quote Price  $   │
  40.   │  State       A2  │ │  Order Qty   N   │ │  Quote Qty    N   │
  41.   │  Zip         A10 │ │                  │ │  Status       A1  │
  42.   └──────────────────┘ └──────────────────┘ └───────────────────┘
  43.  
  44.   In the above tables, each customer may have many orders and many
  45.   quotations.  By manipulating these tables by using queries, you
  46.   will be able to generate a report listing the customers with
  47.   their quotations and orders grouped together.  Follow these
  48.   steps:
  49.  
  50.      1.  Create a new table called "CUSTRPT".  Borrow the structure
  51.          from "ORDERS", then move to record 6 and borrow the
  52.          structure from "QUOTES".  Key the first "Cust#" field and
  53.          delete the extra "Cust#" field on row 6.  You will also
  54.          need to remove the key (the "*") on the Quote# field.
  55.           
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Paradox                                NUMBER  :  500
  75.   VERSION  :  3.0 and up
  76.        OS  :  DOS
  77.      DATE  :  May 4, 1993                              PAGE  :  2/3
  78.  
  79.     TITLE  :  Creating a Report with a One-To-Many Relationship
  80.  
  81.  
  82.  
  83.  
  84.          The "CUSTRPT" table should now have the following
  85.          structure:
  86.  
  87.          ┌───────────────────┐
  88.          │     CUSTRPT       │
  89.          │     ───────       │
  90.          │  Cust#        N*  │
  91.          │  Order#       N*  │
  92.          │  Order Item   A20 │
  93.          │  Order Price  $   │
  94.          │  Order Qty    N   │
  95.          │  Quote#       N   │
  96.          │  Quote Item   A20 │
  97.          │  Quote Price  $   │
  98.          │  Quote Qty    N   │
  99.          │  Status       A1  │
  100.          └───────────────────┘
  101.  
  102.          When you are finished creating the "CUSTRPT" table, press
  103.          [F2].
  104.  
  105.      2.  The next step is to perform an Insert query to insert
  106.          records from the "ORDERS" and "QUOTES" tables into
  107.          "CUSTRPT".  From the Main menu, choose Ask, then select
  108.          the "CUSTRPT" table.  In the left-most column, type
  109.          INSERT.  Then, in each field with a corresponding field in
  110.          the "ORDERS" table, type in a unique example element using
  111.          the [F5] key.  For additional information on example
  112.          elements, refer to Chapter 5 of the User's Guide (for
  113.          version 3.5 and earlier, refer to Chapter 4 of the User's
  114.          Guide).
  115.  
  116.      3.  Move down to the second row of "CUSTRPT" query by pressing
  117.          the down-arrow key.  In the left-most column, type INSERT.
  118.          Then, in each field with a corresponding field to the
  119.          "QUOTES" table, type in a unique example element using the
  120.          [F5] key.  [F5] key.  For additional information on insert
  121.          queries, refer to Chapter 6 of the User's Guide (for
  122.          version 3.5 and earlier, refer to Chapter 4 of the User's
  123.          Guide).
  124.           
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Paradox                                NUMBER  :  500
  141.   VERSION  :  3.0 and up
  142.        OS  :  DOS
  143.      DATE  :  May 4, 1993                              PAGE  :  3/3
  144.  
  145.     TITLE  :  Creating a Report with a One-To-Many Relationship
  146.  
  147.  
  148.  
  149.  
  150.      4.  From the Main menu, choose Ask, then select the "ORDERS"
  151.          table.  In each field, type the example element from the
  152.          corresponding field from the first row of the "CUSTRPT"
  153.          query.
  154.  
  155.      5.  From the Main menu, choose Ask, then select the "QUOTES"
  156.          table.  In each field, type the example element from the
  157.          corresponding field from the second row of the "CUSTRPT"
  158.          query.
  159.  
  160.      6.  Press [F2].  Paradox will insert the records from "ORDERS"
  161.          and "QUOTES" into "CUSTRPT".
  162.  
  163.      7.  Now, create a Free-form report on the "CUSTRPT" table.  In
  164.          the report, place a group on "Cust#" (choose Group |
  165.          Insert).  Then, choose Field | Lookup | Link, select the
  166.          "CUSTOMER" table, and link by the "Cust#" field.  Place
  167.          all the fields from the "CUSTOMER" table in the "Cust#"
  168.          group header.  Continue customizing the report to meet
  169.          your needs.  For additional information on groups and
  170.          lookup, refer to Chapter 8 of the User's Guide (for
  171.          version 3.5 and earlier, refer to the Presenting Data
  172.          manual).
  173.  
  174.      8.  When you are finished designing your report, output your
  175.          report.
  176.  
  177.  
  178.   DISCLAIMER: You have the right to use this technical information
  179.   subject to the terms of the No-Nonsense License Statement that
  180.   you received with the Borland product to which this information
  181.   pertains.
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.